Skip to content

Quick fix to change from WarningTime to WarningTimeTicks and changed …#8504

Open
AnOwlBe wants to merge 2 commits intoSkriptLang:masterfrom
AnOwlBe:feature/FixDeprecatedWorldBorderTimer
Open

Quick fix to change from WarningTime to WarningTimeTicks and changed …#8504
AnOwlBe wants to merge 2 commits intoSkriptLang:masterfrom
AnOwlBe:feature/FixDeprecatedWorldBorderTimer

Conversation

@AnOwlBe
Copy link
Copy Markdown

@AnOwlBe AnOwlBe commented Mar 16, 2026

…EffWorldBorderExpand.java to use worldborder.ChangeSize

Problem

They have been deprecated since mc 1.21.11

Solution

Simply changed a few lines to use the newer system (very small stuff like adding Ticks

Testing Completed

No testing this is minor enough that nothing should break

Supporting Information


Completes: none
Related: none
AI assistance: none

…EffWorldBorderExpand.java to use worldborder.ChangeSize
@AnOwlBe AnOwlBe requested a review from a team as a code owner March 16, 2026 08:27
@AnOwlBe AnOwlBe requested review from Absolutionism and Efnilite and removed request for a team March 16, 2026 08:27
@sovdeeth
Copy link
Copy Markdown
Member

sovdeeth commented Mar 16, 2026

We still support non-1.21.11 versions, so you can't just replace the method. All versions below will need to use the old method and .11+ will need to use the new one.

You should also run some tests for every pr before submitting it, btw, no matter how small.the quickTest task at the very least.

@AnOwlBe
Copy link
Copy Markdown
Author

AnOwlBe commented Mar 16, 2026

So its probably not worth it at all to do this until theres a skript jar that only supports 1.21.11+?

@sovdeeth
Copy link
Copy Markdown
Member

No, look at what I said to do. You just need a version check.

@AnOwlBe
Copy link
Copy Markdown
Author

AnOwlBe commented Mar 16, 2026

Right but the code for it doesn't exist on older versions so it would error on compile unless I am missing something

@UnderscoreTud
Copy link
Copy Markdown
Member

it's fine as long as the method doesn't get called on older versions

input = Math2.fit(1, input, MAX_WORLDBORDER_SIZE);
for (WorldBorder worldBorder : worldBorders)
worldBorder.setSize(input, speed);
if (Objects.equals(Bukkit.getBukkitVersion().split("-")[0], "1.21.11")) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is bad practice for version checking, you should use the Skript#isRunningMinecraft method.
Also since you’re using it quite often, you should cache it statically at the top.

double size = worldBorder.getSize();
size = Math2.fit(1, size + input, MAX_WORLDBORDER_SIZE);
worldBorder.setSize(size, speed);
if (Objects.equals(Bukkit.getBukkitVersion().split("-")[0], "1.21.11")) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

save as above

worldBorder.changeSize(input, speed);
} else {
worldBorder.setSize(input, speed);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Random extra space

Suggested change

worldBorder.setWarningTimeTicks(to.getWarningTimeTicks());
} else {
worldBorder.setWarningTime(to.getWarningTime());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Random extra space

Suggested change

worldBorder.setDamageBuffer(to.getDamageBuffer());
worldBorder.setWarningDistance(to.getWarningDistance());
worldBorder.setWarningTime(to.getWarningTime());
if (Objects.equals(Bukkit.getBukkitVersion().split("-")[0], "1.21.11")) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above with version

@Override
public @Nullable Timespan convert(WorldBorder worldBorder) {
return new Timespan(TimePeriod.SECOND, worldBorder.getWarningTime());
return new Timespan(TimePeriod.SECOND, worldBorder.getWarningTimeTicks());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this version safe?

public void change(Event event, Object @Nullable [] delta, ChangeMode mode) {
long input = delta == null ? 15 : (((Timespan) delta[0]).getAs(TimePeriod.SECOND));
for (WorldBorder worldBorder : getExpr().getArray(event)) {
long warnTime = Objects.equals(Bukkit.getBukkitVersion().split("-")[0], "1.21.11")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above about version checking

// fit and convert back to seconds
int warningTime = ((int) Math2.fit(0, time, Integer.MAX_VALUE)) / 20;
worldBorder.setWarningTime(warningTime);
if (Objects.equals(Bukkit.getBukkitVersion().split("-")[0], "1.21.11")) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above with version checking

worldBorder.setWarningTimeTicks(warningTime);
} else {
worldBorder.setWarningTime(warningTime);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

random extra space

Suggested change

worldBorder.setWarningTime(warningTime);

}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another random extra space

Suggested change

Copy link
Copy Markdown
Member

@APickledWalrus APickledWalrus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR needs to account for the fact that the new methods are now operating with ticks rather than seconds.

When getting, timespans need to be created using the TICK time period. When setting, we need to obtain as ticks.

Unfortunately, the changes are going to be a bit more involved because of this.

@sovdeeth sovdeeth added the enhancement Feature request, an issue about something that could be improved, or a PR improving something. label Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Feature request, an issue about something that could be improved, or a PR improving something.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants